unit untCadAtividade;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters,
  cxContainer, cxEdit, dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinCaramel,
  dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinFoggy,
  dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
  dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins,
  dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
  dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
  dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinPumpkin, dxSkinSeven,
  dxSkinSharp, dxSkinSilver, dxSkinSpringTime, dxSkinStardust,
  dxSkinSummer2008, dxSkinsDefaultPainters, dxSkinValentine,
  dxSkinXmas2008Blue, cxGroupBox, DB, cxTextEdit, cxMemo, cxDBEdit, ADODB,
  Menus, ActnList, StdCtrls, cxButtons, ExtCtrls;

type
  TfrmCadAtividade = class(TForm)
    cxGroupBox1: TcxGroupBox;
    dtEdit: TADOTable;
    cxDBMemo1: TcxDBMemo;
    dtEditTAREFA: TIntegerField;
    dtEditDATA: TDateTimeField;
    dtEditUSUARIO: TIntegerField;
    dtEditDESCRICAO: TMemoField;
    dtEditCODIGO: TAutoIncField;
    dsEditt: TDataSource;
    Panel1: TPanel;
    cxButton2: TcxButton;
    cxButton1: TcxButton;
    ActionList1: TActionList;
    ActSave: TAction;
    ActESC: TAction;
    ActCadLookup: TAction;
    ActInsert: TAction;
    ActEdit: TAction;
    procedure dtEditNewRecord(DataSet: TDataSet);
    procedure ActSaveExecute(Sender: TObject);
    procedure ActESCExecute(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmCadAtividade: TfrmCadAtividade;

implementation

uses untCadTarefa, untDmPrincipal;

{$R *.dfm}

procedure TfrmCadAtividade.dtEditNewRecord(DataSet: TDataSet);
begin
  dtEditDATA.value := Date;
  dtEditUSUARIO.Value := dmPrincipal.usuario_logado_codigo;
  dtEditTAREFA.Value :=  FrmCadTarefa.dtEditCODIGO.Value;
end;

procedure TfrmCadAtividade.ActSaveExecute(Sender: TObject);
begin
  dtEdit.Post;
  Close;
end;

procedure TfrmCadAtividade.ActESCExecute(Sender: TObject);
begin
  dtEdit.Cancel;
  Close;
end;

end.
